package com.it.config;

import com.it.bean.Person;
import com.it.services.BookService;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

@Configuration
@ComponentScan(value = "com.it.bean")
/*@ComponentScan(value = "com.it",excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class, Service.class})
})*/
/** @ComponentScan(value = "com.it", includeFilters = {
@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class})
}, useDefaultFilters = false)
 @ComponentScans({
 @ComponentScan(value = "com.it", includeFilters = {
 @ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class}),
 @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {BookService.class}),
 @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})
 }, useDefaultFilters = false)
 })*/
public class MainConfig {

    /**
     * 给容器中注册一个Bean，类型位返回值的类型，id默认是用方法名做id
     *
     * @author agstar
     * @date 2019/6/15 14:38
     */
    @Bean(name = "person")
    public Person person() {
        return new Person("hahahah", 1111);
    }
    @Bean(name = "person", initMethod = "testinit")
    public Person person11() {
        return new Person("xiaowang", 20);
    }


}
